package com.interview.item.javabase.stringdemo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * @Author:zxh
 * @Description: string,stringBuffer,stringBuilder
 * @Date: 2020/3/23
 * @Modified By:
 */
public class StringDemo {
    private static Logger logger = (Logger) LoggerFactory.getLogger(StringDemo.class);

    /**
      * @Author:zxh
      * @Description: 只要对String的修改都会导致新的对象生成，StringBuffer不会
      * @Date: 2020/3/23
      */
    public static void modify(){
        String strA= "abc";
        strA = "cbd";
        logger.info(strA);

        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(34);
        stringBuffer.append("one");
        logger.info(stringBuffer.toString());

    }

    /**
      * @Author:zxh
      * @Description: 测试最后一个字符是否为"="号
      * @Date: 2020/4/17
      */
    public static void testStrLast(){
       /* String str = "sdifweoodo==s==2=";
        char c = str.charAt(str.length()-1);
        if ("=".equals(String.valueOf(c))) {
            str = str.substring(0, str.length() - 1);
        }
        System.out.println("shuchu:"+str+": "+c+" ： "+str.length());*/
    }
    public static void main(String[] args) {
        //modify();
        testStrLast();

    }
}
